import requestV2 from "@/utils/requestV2";

export function add(vue, params, success, finallyFuc) {
  vue.$request.post({
    url: "superAdmin/adMenu/addV2",
    params: params,
    success: success,
    finally: finallyFuc
  });
}

export function remove(vue, params, success, finallyFuc) {
  vue.$request.post({
    url: "superAdmin/adMenu/deleteV2",
    params: params,
    success: success,
    finally: finallyFuc
  });
}

export function update(vue, params, success, finallyFuc) {
  vue.$request.post({
    url: "superAdmin/adMenu/updateV2",
    params: params,
    success: success,
    finally: finallyFuc
  });
}

export function getMenuList() {
  return requestV2({
    url: "superAdmin/adMenu/list",
    method: "post"
  });
}

export function getMenuIdsByRoleId(roleId) {
  return requestV2({
    url: "superAdmin/adMenu/idsByRoleId",
    method: "get",
    params: {
      roleId: roleId
    }
  });
}

export function listMenuByAdId(adId) {
  return requestV2({
    url: `superAdmin/adMenu/listMenuByAdId?adId=${adId}`,
    method: "get"
  });
}